home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Day Cry
/
Day Cry CD.bin
/
oh_towns
/
taropyon
/
silib
/
silib.lzh
/
PRG
/
SDKFS
/
FSELINI.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-12-05
|
3KB
|
122 lines
/*************************************************************************
* âtâ@âCâïâZâîâNâ^
*************************************************************************/
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <silib.h>
#include <sifs.h>
#include "sdkfs.h"
#include "sdkfscf.h"
#define SBATT (SB_ATT_VERTICAL | SB_ATT_MAXADJUST | SB_ATT_DRAGSLD | SB_ATT_BTNREP)
/*************************************************************************
* âtâ@âCâïâZâîâNâ^é╠âIü[âvâô
*************************************************************************/
FILESEL_T *FileSel_open(void)
{
FILESEL_T *fs;
if ( (fs = SI_CALLOC(sizeof(FILESEL_T),1)) == NULL )
return (NULL);
fs->dlg = BLKDLG_open( fsFunc_dlgdsp, fs );
fs->ev = EV_workAlloc(NULL,8);
fs->evDrv = EV_workAlloc(fs->ev,26);
fs->evFn = EV_workAlloc(fs->ev,FSDSP_FNUM);
fs->sb = SB_open( SBATT, NULL, fsFunc_sbar, fs );
SB_ev_workAlloc( fs->sb, fs->ev);
if ( !fs->dlg || !fs->ev || !fs->evDrv || !fs->evFn || !fs->sb )
{
if ( fs->dlg ) BLKDLG_close(fs->dlg);
if ( fs->ev ) EV_workFree(fs->ev);
if ( fs->evDrv ) EV_workFree(fs->evDrv);
if ( fs->evFn ) EV_workFree(fs->evFn);
if ( fs->sb ) SB_close(fs->sb);
SI_FREE(fs);
return (NULL);
}
fs->err = FSERR_UNREAD;
fs->drv = FS_getdrv();
FS_getdir2(fs->whare);
fs->dlg->rect.xs = FSDLG_XS;
fs->dlg->rect.ys = FSDLG_YS;
fs->sort = FSSORT_FILE | FSSORT_DIRTOP;
fs->posMark = -1;
return (fs);
}
/*************************************************************************
* âtâ@âCâïâZâîâNâ^é╔âNâìü[âY
*************************************************************************/
void FileSel_close( FILESEL_T *fs )
{
if ( !fs )
return;
FileSel_clearFndat( fs );
if ( fs->title ) SI_FREE(fs->title);
if ( fs->wild ) SI_FREE(fs->wild);
if ( fs->dlg ) BLKDLG_close(fs->dlg);
if ( fs->ev ) EV_workFree(fs->ev);
if ( fs->evDrv ) EV_workFree(fs->evDrv);
if ( fs->evFn ) EV_workFree(fs->evFn);
if ( fs->sb ) SB_close(fs->sb);
SI_FREE(fs);
}
/*************************************************************************
* â^âCâgâïé╠É▌ÆΦ
*************************************************************************/
int FileSel_setTitle( FILESEL_T *fs, CONST char *form, ... )
{
char tmp[BUFSIZ];
va_list arg;
va_start(arg,form);
vsprintf(tmp,form,arg);
va_end(arg);
if ( fs->title )
SI_FREE(fs->title);
if ( (fs->title = SI_MALLOC(strlen(tmp)+1)) == NULL )
return (ERR);
strcpy( fs->title, tmp );
return (NORMAL);
}
/*************************************************************************
* âÅâCâïâhâJü[âhé╠É▌ÆΦ
*************************************************************************/
int FileSel_setWild( FILESEL_T *fs, CONST char *wild )
{
if ( fs->wild )
SI_FREE(fs->wild);
if ( (fs->wild = SI_MALLOC(strlen(wild)+1)) == NULL )
return (ERR);
strcpy( fs->wild, wild );
return (NORMAL);
}
/*************************************************************************
* ôⁿù═âtâ@âCâïû╝é╠ĵô╛
*************************************************************************/
char *FileSel_getFn( FILESEL_T *fs )
{
if ( !fs )
return ("");
return (fs->buf);
}